// Toggle Script
(function() {
	var container = document.getElementById( 'container' ),
		trigger = container.querySelector( 'button.trigger' ),
        preorder = container.querySelector('button#preorder');
        coupon = container.querySelector('button#coupon');
    var html1 = "<h1>订单预约</h1><p>请填写您的信息后递交，我们将第一时间为您服务</p>",
    	html2 = "<h1>最高优惠</h1><p>我们给予您的是行业内最高的优惠！</p>";
	function toggleContent(param) {
		if(param == 1){
			document.querySelector("#content1").style.display = "block";
			document.querySelector("#content2").style.display = "none";
			$("#notify-after").html(html1);
		} else if(param == 2){
			document.querySelector("#content1").style.display = "none";
			document.querySelector("#content2").style.display = "block";
			$("#notify-after").html(html2);
		} 


		if( classie.has( container, 'container-open' ) ) {
			classie.remove( container, 'container-open' );
			classie.remove( trigger, 'trigger-active' );
			classie.add( document.querySelector("body"), 'no_scroll' );

			// window.addEventListener( 'scroll', noscroll );
		}
		else {
			classie.add( container, 'container-open' );
			classie.add( trigger, 'trigger-active' );
			// window.removeEventListener( 'scroll', noscroll );
			classie.remove( document.querySelector("body"), 'no_scroll' );
		}
	}

	function noscroll() {
		// window.scrollTo( 0, 0 );
		// return false;
		// document.body.style.position = "fixed";
	}

	// reset scrolling position
	document.body.scrollTop = document.documentElement.scrollTop = 0;

	// disable scrolling
	// window.addEventListener( 'scroll', noscroll );

    trigger.addEventListener( 'click', toggleContent );
    preorder.addEventListener( 'click', function(){
    	toggleContent(1);
    } );
    coupon.addEventListener( 'click', function(){
    	toggleContent(2);
    } );

	// For Demo purposes only (prevent jump on click)
	[].slice.call( document.querySelectorAll('.content-wrapper a') ).forEach( function(el) { el.onclick = function() { return false; } } );
})();

// screen loader
$(window).load(function() {
    "use strict";
    $('.screen-loader').fadeOut('slow');
});


// preload
$(document).ready(function() {
    "use strict";
    $('#preload').css({
        display: 'table'
    });
});


// preload function
$(window).load(preLoader);
"use strict";

function preLoader() {
    setTimeout(function() {
        $('#preload').delay(1000).fadeOut(1500);
    });
};

// niceScroll
$(document).ready(function() {
    "use strict";
    $("body").niceScroll({
        cursorcolor: "#fff",
        cursorwidth: "5px",
        cursorborder: "1px solid #fff",
        cursorborderradius: "0px",
        zindex: "9999",
        scrollspeed: "60",
        mousescrollstep: "40"
    });
});


// niceScroll || scrollbars resize
$("body").getNiceScroll().resize();
